﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace MailSenderPro.Forms
{
    public partial class FrmSmtpList : Form , Util.IKaydedilebilir
    {
        public FrmSmtpList()
        {
            InitializeComponent();
        }

        private void FrmSmtpList_Load(object sender, EventArgs e)
        {
            this.bndSmtp.DataSource = Util.Globals.SmtpList; 
        }

        #region IKaydedilebilir Members

        public void Save()
        {

            try
            {
                FileStream fs = new FileStream(Path.Combine(Application.StartupPath, "smtp.bin"), FileMode.OpenOrCreate);
                StreamWriter sw = new StreamWriter(fs);

                BinaryFormatter formater = new BinaryFormatter();

                formater.Serialize(fs, Util.Globals.SmtpList);
                fs.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


        }

        #endregion
    }
}
